
configure_file(${ROOT_AT32F403A_407_Firmware_Library}/libraries/cmsis/cm4/device_support/at32f403a_407_conf_template.h ${CMAKE_CURRENT_BINARY_DIR}/at32f403a_407_conf.h)
add_library(Firmware_Library_config INTERFACE)
target_include_directories(Firmware_Library_config INTERFACE
    ${ROOT_AT32F403A_407_Firmware_Library}/libraries/cmsis/cm4/device_support
    ${CMAKE_CURRENT_BINARY_DIR}
)
target_sources(Firmware_Library_config INTERFACE
    ${ROOT_AT32F403A_407_Firmware_Library}/libraries/cmsis/cm4/device_support/system_at32f403a_407.c
    ${ROOT_AT32F403A_407_Firmware_Library}/libraries/cmsis/cm4/device_support/startup/gcc/startup_at32f403a_407.s
)

file(GLOB_RECURSE src
    ${ROOT_AT32F403A_407_Firmware_Library}/libraries/drivers/*.c
    ${ROOT_AT32F403A_407_Firmware_Library}/libraries/drivers/*.c
)
add_library(Firmware_Library STATIC ${src})

target_include_directories(Firmware_Library PUBLIC
    ${ROOT_AT32F403A_407_Firmware_Library}/libraries/cmsis/cm4/core_support
    ${ROOT_AT32F403A_407_Firmware_Library}/libraries/drivers/inc
)

target_link_libraries(Firmware_Library PUBLIC Firmware_Library_config)

set_property(TARGET Firmware_Library PROPERTY LINK_FILE ${ROOT_AT32F403A_407_Firmware_Library}/libraries/cmsis/cm4/device_support/startup/gcc/linker/AT32F403AxG_FLASH.ld)